<template>
<div>count的值:{{count}}</div>
<button @click="addCount">count+1</button>
<button @click="addCountN(3,$event)">count+n</button>

</template>

<script setup>
import {
    ref
} from 'vue'
const count = ref(1)
const addCount = (e) => {
    count.value++
    if (count.value % 2 == 0) {
        e.target.style.color = 'red'

    } else {
        e.target.style.color ='blue'
    }
}
const addCountN = (n,e) => {
    count.value+=n
    if (count.value % 2 == 0) {
        e.target.style.color = 'red'

    } else {
        e.target.style.color ='blue'
    }
}
</script>
